//
//  WYLable.m
//  WYNews
//
//  Created by 曾佳豪 on 2017/3/18.
//  Copyright © 2017年 haodada.com. All rights reserved.
//

#import "WYLable.h"

//设置字体大小

const CGFloat bigFontSize =20;
const CGFloat smallFontSize =16;
@implementation WYLable

+(WYLable *)labelwithModel:(WYChannelModel *)model{
    //实例化L
    WYLable *lable= [[WYLable alloc]init];
    //设置文字(频道名)
    lable.text =model.tname;
    //设置文字居中
    lable.textAlignment = NSTextAlignmentCenter;
    //设置文字大小(初始化为大字体)
    lable.font =[UIFont systemFontOfSize:bigFontSize];
    //设置文字颜色
    lable.textColor =[UIColor redColor];
    //自适应
    [lable sizeToFit];
    
    return  lable;
}
-(void)setIsSelected:(BOOL)isSelected{
    
    _isSelected =isSelected;
    
    //判断 当不被选中时 显示小字黑色
    if (_isSelected ==NO) {
        //
        self.font =[UIFont systemFontOfSize:smallFontSize];
        self.textColor =[UIColor blackColor];
    }else{
        //否则就是被选中的状态 显示大字红色
        self.font=[UIFont systemFontOfSize:bigFontSize];
        self.textColor =[UIColor redColor];
    }
    
}

@end
